<div class="bjui-pageContent">
    <form action="{:U($Think.ACTION_NAME)}" id="addForm" class="pageForm" data-toggle="validate" data-reload-navtab="true">
        <input type="hidden" id="pk" name="info[id]" value="{$info.id}">
        <table class="table table-condensed table-hover" width="100%">
            <tbody>
            <tr>
                <td colspan="2">
                    <label class="control-label x100">标题：</label>
                    <input id="title" class="checktitle" type="text" name="info[title]" value="{$info.title}" size="60" data-rule="required" />
                    <a href="javascript:void(0)" id="checkNewsTitle">检测是否重复</a>
                </td>
            </tr>
            <tr>
                <td>
                    <label class="control-label x100">所属分类：</label>
                    <select name="info[cid]" data-toggle="selectpicker" data-width="300">
                            <option value="1" <if condition="1 eq $info[type]">selected="selected"</if>>
                            直播
                            </option>
                            <option value="2" <if condition="2 eq $info[type]">selected="selected"</if>>
                        名师
                            </option>
                    </select>
                </td>
                <td>
                    <label class="control-label x100">发布状态：</label>
                    <input type="radio" name="info[status]" data-toggle="icheck" value="0" data-rule="checked" data-label="审核中&nbsp;&nbsp;" <if condition="$info.status eq 0">checked</if>>
                    <input type="radio" name="info[status]" data-toggle="icheck" value="1" data-label="已发布" <if condition="$info.status eq 1">checked</if>>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <label class="control-label x100">关键词：</label>
                    <input type="text" name="info[keywords]" value="{$info.keywords}" data-rule="required" placeholder="多关键词间用半角逗号分开" size="60" /> 多关键词间用半角逗号分开
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <label class="control-label x100">文章描述：</label>
                    <textarea name="info[description]" style="width:784px;height:50px" data-toggle="autoheight" data-rule="required">{$info.description}</textarea>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <label class="control-label x100">文章摘要：</label>
                    <textarea name="info[summary]" style="width:784px;height:50px" data-toggle="autoheight" data-rule="required">{$info.summary}</textarea>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <label class="control-label x100">视频上传：</label>
                    <input type="text" id="thumbnail_text" name="info[thumbnail]" value="{$info.video}" size="30" data-rule="required" readonly="readonly" />
                    <div style="display: inline-block; vertical-align: middle;">
                        <div id="doc_pic_up" data-toggle="upload" data-uploader="{:U('upload')}"
                             data-file-size-limit="{$vsize[1]}"
                             data-file-type-exts="*.flv;*.avi;*.mp4;*.qt;*.mov;*.rmvb;*.mpeg"
                             data-multi="true"
                             data-breakPoints="true"
                             data-on-upload-success="doc_upload_success"
                             data-icon="cloud-upload"></div>
                    </div>格式(flv,mp4,avi,qt,mov,rmvb,mpeg等) 上传大小{$vsize[0]}M
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <label class="control-label x100">文章内容：</label>
                    <div style="display: inline-block; vertical-align: middle;">
                        <textarea name="info[content]" style="width:784px;height:50px" data-toggle="kindeditor" data-rule="required" data-items="'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste','plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright','justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript','superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/','formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold','italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak','anchor', 'link', 'unlink', '|', 'about'">{$info.msg}</textarea>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
    </form>
</div>

<div class="bjui-pageFooter">
    <ul>
        <li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
        <li><button type="submit" class="btn-default" data-icon="save">保存</button></li>
    </ul>
</div>

<script type="text/javascript">
    // 单独调用KindEditor图片插件
    function doc_upload_success(file, data) {
        var json = $.parseJSON(data)
        $(this).bjuiajax('ajaxDone', json);
        if (json[BJUI.keys.statusCode] == BJUI.statusCode.ok) {
            $('#thumbnail_text').val(json.filename)
        }
    }

    // 检查标题是否重复
    $("#checkNewsTitle").click(function() {
        $.getJSON("{:U(checkArticleTitle)}", {
            title: $("#title").val(),
            id: "{$info.id}"
        }, function(json) {
            $("#checkNewsTitle").css("color", json.statusCode == 200 ? "#0f0" : "#f00").html(json.message);
        });
    });
    $(".checktitle").blur(function() {
        $.getJSON("{:U(checkArticleTitle)}", {
            title: $("#title").val(),
            id: "{$info.id}"
        }, function(json) {
            $("#checkNewsTitle").css("color", json.statusCode == 200 ? "#0f0" : "#f00").html(json.message);
        });
    });
</script>